<script type="text/javascript">
function add_status(id) {
	$("#add_status").before('<p id="attachment' + id + '"><select name="status[]"><volist name="statusList" id="vo"><option value="{$vo.name}">{$vo.name}</option></volist></select> <a href=\'javascript:$("#attachment' + id + '").remove();\'>{:L('DELETE')}</a></p>');
	$("#add_status").attr('href', 'javascript:add_status(' + (id+1) + ');');
}
</script>
<form class="form-horizontal" action="{:U('setting/statusflowedit')}" method="post">
	<input type="hidden" name="flow_id" value="{$flow.flow_id}"/>
	<table class="table">
		<tr>
			<th colspan="2">{:L('BASIC_INFO')}</th>
		</tr>
		<tr>
			<td width="20%" class="tdleft">{:L('STATE_OF_FLOW')}</td>
			<td><input class="text-input small-input" type="text" name="name" id="name" value="{$flow.name}"/></td>
		</tr>
		<tr>
			<td class="tdleft">{:L('STATE_FLOW_CONTENT')}</td>
			<td>
				<volist name="data" id="temp" key="k"> 
					<p id="exist_status{$k}">
						<select name="status[]">
							<volist name="statusList" id="vo">
								<option <if condition="$temp eq $vo['status_id']"> selected="selected"</if> value="{$vo.status_id}"> {$vo.name}</option>
							</volist>
						</select>
						<a href="javascript:$('#exist_status{$k}').remove();">{:L('DELETE')}</a>
					</p>
				</volist>
				<a id="add_status" href="javascript:add_status(1);">{:L('ADD_A_STATE')}</a>
			</td>
		</tr>
		<tr>
			<td class="tdleft">{:L('DESCRIBE')}</td>
			<td><textarea class="span4" name="description">{$flow.description}</textarea></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td><input class="btn btn-primary" type="submit" value="{:L('SAVE')}"/> &nbsp;
			<input class="btn" type="button" onclick="javascript:$('#dialog-edit').dialog('close');" value="{:L('CANCEL')}"/></td>
		</tr>
	</table>
</form>

